<template>
	<view class="upload">
		<u--form labelPosition="left" :model="formData" :rules="rules" ref="form1" >
			<view class="formItem">
				<u-form-item label="项目LOGO" prop="project_logo" :borderBottom="true" ref="item1" labelWidth="100" v-if="edit"
					labelPosition="top"  >
					<imgUpload code="zsbm" placeholder="请上传图片" :limit="1" @upImgs="upImgs" ref="imgUpload"
						:imageArr="logImgArr" :disable="type==1" :showdel="type!=1"></imgUpload>
				</u-form-item>
				<u-form-item label="项目编号" :borderBottom="true" ref="item1" labelWidth="100" 
					v-if="formData.project_no">
					<u--input v-model="formData.project_no" border="none" placeholder="请输入项目编号"
						:disabled="true"></u--input>
				</u-form-item>
				<u-form-item label="项目主体" labelWidth="90" prop="subject_name" borderBottom @click="hideKeyboard();"
					ref="item1" >
					<view class="" v-if="!edit">
						{{formData.subject_name}}
					</view>
					<view class="flex-right" v-if="edit">
						<vvSelect placeholder="请选择" class="select" :list="subject_list" label="name"
							valueKey="subject_id" :name="formData.subject_name" ref="vvSelect2" @change="pickerChange2"
							v-model="formData.subject_id"></vvSelect>
						<u-icon slot="right" name="arrow-down"></u-icon>
					</view>
				</u-form-item>
				<u-form-item label="项目名称" prop="project_name" borderBottom ref="item1" labelWidth="90"
					labelPosition="left">
					<view class="" v-if="!edit">
						{{formData.project_name}}
					</view>
					<u--input v-if="edit" v-model="formData.project_name" border="none" placeholder="请输入项目名称"></u--input>
				</u-form-item>
				<u-form-item label="项目类型" labelWidth="90" prop="type_name" borderBottom
					@click="hideKeyboard();popupShow = true;" ref="item1">
					<view class="" v-if="!edit">
						{{formData.type_name?formData.type_name:'暂无'}}
					</view>
					<view class="flex-right"  v-if="edit">
						<vvSelect placeholder="请选择" class="select" :list="type_list" label="name" valueKey="type_id"
							:name="formData.type_name" ref="vvSelect1" @change="typeChange" v-model="formData.type_id">
						</vvSelect>
						<u-icon slot="right" name="arrow-down"></u-icon>
					</view>
				</u-form-item>
				<u-form-item label="项目负责人" prop="project_leader"  ref="item1" labelWidth="90"
					labelPosition="left" >
					<view class="" v-if="!edit">
						{{formData.project_leader}}
					</view>
					<u--input v-if="edit" v-model="formData.project_leader" border="none" placeholder="请输入项目负责人"></u--input>
				</u-form-item>
			</view>
			<!-- 第二部分 -->
			<view class="formItem">
			<u-form-item label="兜底单位" prop="pocket_unit" borderBottom ref="item1" labelWidth="90" labelPosition="left">
				<view class="" v-if="!edit">
					{{formData.pocket_unit}}
				</view>
				<u--input v-if="edit" v-model="formData.pocket_unit" border="none" placeholder="请输入兜底单位"></u--input>
			</u-form-item>
			<!-- <u-form-item label="项目优先级" borderBottom labelWidth="100" labelPosition="left"  >
				<view class="" v-if="!edit">
					{{radiovalue1}}
				</view>
				<u-radio-group v-model="radiovalue1" placement="row" v-if="edit">
					<u-radio :customStyle="{fontSize:'30rpx'}" v-for="(item, index) in radiolist1"
						:key="index" :label="item.name" :name="item.name" @change="priorityChange(item.value)"
						shape="circle" :value="item.value">
					</u-radio>
				</u-radio-group>
			</u-form-item> -->
			<u-form-item label="是否立项" borderBottom labelWidth="90" labelPosition="left">
				<view class="" v-if="!edit">
					{{radiovalue2 == '否'?'未立项':'已立项'}}
				</view>
				<u-radio-group v-if="edit" v-model="radiovalue2" placement="row">
					<u-radio  v-for="(item, index) in radiolist2" :key="index"
						:label="item.name" :name="item.name" @change="lxChange(item.value)" shape="circle">
					</u-radio>
				</u-radio-group>
			</u-form-item>
			<u-form-item label="项目完成状态" labelWidth="110" prop="status" borderBottom
				@click="hideKeyboard();popupShow = true;" ref="item1"  >
				<view class="" v-if="!edit">
					{{formData.status == 1?'开发中':(formData.status == 2?'建设中':'已暂停')}}
				</view>
				<view class="flex-right" v-if="edit">
					<vvSelect placeholder="请选择" class="select" :list="radiolist3" label="name" valueKey="value"
						:name="finishStatusName" ref="vvSelect1" @change="finishChange" v-model="formData.status">
					</vvSelect>
					<u-icon slot="right" name="arrow-down"></u-icon>
				</view>
				
			</u-form-item>
	
			<!-- 这个区域内后面的内容都是新增的需要配后后台传参修改，需要获取接口对应的内容，vvselect组件内容需要修改此处仅仅是添加了内容 -->
			<u-form-item label="付款状态" labelWidth="90" prop="pay_status" borderBottom
				@click="hideKeyboard();popupShow = true;" ref="item1"  >
				<view class="" v-if="!edit">
					{{formData.pay_status == 1?'已付款':'未付款'}}
				</view>
				<view class="flex-right" v-show="edit">
					<vvSelect placeholder="请选择" class="select" :list="payStatus" label="name" valueKey="value"
						:name="payStatusName" ref="vvSelect1" @change="payChange" v-model="formData.pay_status">
					</vvSelect>
					<u-icon slot="right" name="arrow-down"></u-icon>
				</view>
				
			</u-form-item>
			<u-form-item label="付款金额（单位/元）" prop="pay_money" borderBottom ref="item1" labelWidth="160" labelPosition="left">
				<view class="" v-if="!edit">
					{{formData.pay_money?formData.pay_money:0}}
				</view>
				<u--input v-if="edit" v-model="formData.pay_money" border="none" placeholder="请输入付款金额"></u--input>
			</u-form-item>
			<u-form-item label="装机量（兆瓦MW）" prop="zj_num" borderBottom ref="item1" labelWidth="160" labelPosition="left">
				<view class="" v-if="!edit">
					{{formData.zj_num?formData.zj_num:0}}
				</view>
				<u--input v-if="edit" v-model="formData.zj_num" border="none" placeholder="兆瓦"></u--input>
			</u-form-item>
			<u-form-item label="（兆瓦时MWH）" prop="zj_num_mwh" borderBottom ref="item1" labelWidth="180" labelLeft="80rpx" labelPosition="left">
				<view class="" v-if="!edit">
					{{formData.zj_num_mwh?formData.zj_num_mwh:0}}
				</view>
				<u--input v-if="edit" v-model="formData.zj_num_mwh" border="none" placeholder="兆瓦时"></u--input>
			</u-form-item>
			<u-form-item label="备案状态" labelWidth="90" prop="filings_status" borderBottom
				@click="hideKeyboard();popupShow = true;" ref="item1"  >
				<view class="" v-if="!edit">
					{{formData.filings_status == 1?'已备案':'未备案'}}
				</view>
				<view class="flex-right" v-if="edit">
					<vvSelect placeholder="请选择" class="select" :list="preStatus" label="name" valueKey="value"
						:name="filingStatusName" ref="vvSelect1" @change="preChange" v-model="formData.filings_status">
					</vvSelect>
					<u-icon slot="right" name="arrow-down"></u-icon>
				</view>
			</u-form-item>
			<u-form-item label="获取接入批复状态" labelWidth="140" prop="approval_status" borderBottom
				@click="hideKeyboard();popupShow = true;" ref="item1"  >
				<view class="" v-if="!edit">
					{{formData.approval_status == 1?'已获取计入批复':'未获取批复'}}
				</view>
				<view class="flex-right" v-if="edit">
					<vvSelect placeholder="请选择" class="select" :list="appStatus" label="name" valueKey="value"
						:name="approvalStatusName" ref="vvSelect1" @change="appChange" v-model="formData.approval_status">
					</vvSelect>
					<u-icon slot="right" name="arrow-down"></u-icon>
				</view>
				
			</u-form-item>
			<!-- 区域选择如果是省市区三级联动的时候需要用另一个组件，已写好，在components下vv-select-area，用法和vvSelect差不多 -->
			<u-form-item label="区域" labelWidth="80" prop="area_id" 
				@click="hideKeyboard();popupShow = true;" ref="item1"  >
				<view class="" v-if="!edit">
					{{formData.area_name?formData.area_name:'暂无'}}
				</view>
				<view class="flex-right" v-if="edit">
					<vvSelect placeholder="请选择" class="select" :list="cityList" label="name" valueKey="id"
						:name="formData.area_name" ref="vvSelect1" @change="pickerCity" v-model="formData.area_id">
					</vvSelect>
					<u-icon slot="right" name="arrow-down"></u-icon>
				</view>
			</u-form-item>
			<!-- 2期新增的内容完 -->
			</view>
			<!-- 第三部分 -->
			<view class="formItem">
			<u-form-item label="项目内容" prop="project_content" :borderBottom="false" ref="item1" labelWidth="90"
				labelPosition="top">
				<view class="txt-left">
					<u--textarea placeholder="请输入项目内容" v-model="formData.project_content" :count="false" autoHeight :disabled = '!edit'
						maxlength="-1" height="100">
					</u--textarea>
				</view>
			</u-form-item>
			<u-form-item label="项目图片" prop="project_pics" :borderBottom="false" ref="item1" labelWidth="90" 
				labelPosition="top">
				<view class="" style="display: flex;flex-wrap: wrap;">
					<view class="" v-for="i in imgArr" v-show="!edit">
						<image :src="i.url" mode="" style="width: 140rpx;height: 140rpx;margin: 0 8rpx 8rpx 0;"></image>
					</view>
				</view>
				
				<imgUpload code="zsbm" placeholder="请上传图片" :limit="6" @upImgs="upImgs1" ref="imgUpload1"  v-show="edit"
					:imageArr="imgArr" :disable="type==1" :showdel="type!=1" :maxCount="6"></imgUpload>
			</u-form-item>
			</view>
			
			<!-- <view class="other-list" v-if="type == 0">
				<view class="left">
					<radio-group activeColor="#157DFA">
						<label v-for="(item, index) in List" :key="index">
							<radio :class="active == index ? 'checked' : ''" :checked="active== index" :value="index"
								@click="radioChange1(index)" activeColor="#157DFA" />
						</label>
					</radio-group>
				</view>
				<view class="right">
					同意<text style="color: #47578E;" @click="goPro">《项目隐私协议》</text>
				</view>
			</view> -->
		</u--form>
		<view class="addpro" v-if="type == 0">
			<u-button class="custom-style" text="创建项目"
				customStyle="background-color: #47578E;color:#fff;margin-top:20px;border-radius: 40px;" @click="goAuth">
			</u-button>
		</view>
		<!-- 下面的评论是一期的内容，需要结合父组件修改，可以把父组件type设置为0时候就隐藏了,暂时隐藏 -->
		<!-- <view class="myList" v-if="type != 0" style="position: relative;">
			<view class="evalute">
				项目评论 ({{detailComment.length}})
			</view>
			<listEvaluate v-for="(i,index) in detailComment" :key="index" :item="i">
			</listEvaluate>
		</view> -->
		<view class="goNews" v-if="type != 0">
			<u-button type="primary" icon="email" text="消息推送" customStyle="background-color:#47578E;width: 40%;" @click="getMessage"></u-button>
		</view>
		<u-action-sheet :show="typeStatus" :actions="type_list" title="请选择" @close="typeStatus = false"
			@select="typeSelect" :closeOnClickOverlay="true" :closeOnClickAction="true">
		</u-action-sheet>
		</u-action-sheet>
		<u-action-sheet :show="showSubject" :actions="subject_list" title="请选择" @close="showSubject = false"
			@select="subjectSelect"></u-action-sheet>
		<view class="showEvaluate">
			<centerShow :showPop="showCenter" @refuse="refuse" @submit="subTel" :tip='tip' :edit ='edit'>
			</centerShow>
		</view>
	</view>
</template>

<script>
	import {
		projectCreate,
		projectUpd,
		projectdel,
		areaList
	} from '@/request/api.js'
	import imgUpload from '@/components/common/imgUpload.vue'
	import listEvaluate from '@/components/common/listEvaluate.vue'
	import centerShow from '@/components/common/centerShow.vue'
	import vvSelect from '@/components/vv-select/vv-select.vue'
	import {
		mapActions,
		mapMutations
	} from 'vuex'
	export default {
		props: {
			type: {
				default: 1, //自定义组件中，0为新增，1为详情，2可修改
				type: Number
			},
			edit: {
				type: Boolean,
				default: false
			},
			detailsData: {
				type: Object,
				default: {}
			},
			detailsId: {
				type: String,
				default: ''
			},
			detailComment: {
				type: Array,
				default: []
			}
		},
		components: {
			imgUpload,
			listEvaluate,
			centerShow,
			vvSelect
		},
		computed: {
			payStatusName(){
				return this.formData.pay_status ? this.payStatus.filter(item => item.value == this.formData.pay_status)[0]?.name : ''
			},
			finishStatusName(){
				return this.formData.status ? this.radiolist3.filter(item => item.value == this.formData.status)[0]?.name : ''
			},
			filingStatusName(){
				return this.formData.filings_status ? this.preStatus.filter(item => item.value == this.formData.filings_status)[0]?.name : ''
			},
			approvalStatusName(){
				return this.formData.approval_status ? this.appStatus.filter(item => item.value == this.formData.approval_status)[0]?.name : ''
			},
		},
		watch: {
			payStatusName(val){
				console.log(val,'val')
			}
		},
		data() {
			return {
				sel: true,
				List: [{
					name: '协议'
				}],
				active: 0, // 选中协议与否
				showBottom: false,
				showCenter: false,
				logImgArr: [],
				imgArr: [],
				tip: '',
				actions: [{
						name: '男',
					},
					{
						name: '女',
					},
					{
						name: '保密',
					},
				],
				formData: {
					project_leader: '', //项目负责人
					project_name: '', //项目名称
					project_no: '', //项目编号
					pocket_unit: '', //兜底单位
					status: "", //完成状态 完成状态 
					project_content: '', //项目内容
					project_pics: '', //图片
					// project_priority: '2', //项目推进优先级 项目推进优先级 1=正常推进,2=优先推进
					project_logo: '', //项目logo
					is_lx: '1', //是否立项 1是 0否
					type_id: '', //项目类型id
					type_name: '', //类型名称
					subject_name: '', //主体名称
					subject_id: '', //主体id
					area_id:'',
					area_name:'',
					zj_num:'',//装机量
					zj_num_mwh: '', // 装机量 兆瓦时
					filings_status:'',
				},
				gacadeUp: [
					// {
					// 	url: 'https://cdn.uviewui.com/uview/swiper/1.jpg',
					// },
					// {
					// 	url: 'https://cdn.uviewui.com/uview/swiper/1.jpg',
					// },
				],
				typeStatus: false,
				type_list: [],
				pay_list:[],
				subject_list: [],
				is_lx: [],
				showSubject: false,
				radiolist1: [{
						name: '优先推进',
						value: 2,
						disabled: false
					},
					{
						name: '正常推进',
						value: 1,
						disabled: false
					}
				],
				radiovalue3: '',
				radiolist3: [{
						name: '开发中',
						value: '1',
						disabled: false
					}, {
						name: '建设中',
						value: '2',
						disabled: false
					},
					{
						name: '已暂停',
						value: '3',
						disabled: false
					}
				],
				payStatus: [{
						name: '已付款',
						value: '1',
						disabled: false
					}, {
						name: '未付款',
						value: '2',
						disabled: false
					}
				],
				preStatus: [{
						name: '已备案',
						value: '1',
						disabled: false
					}, {
						name: '未备案',
						value: '2',
						disabled: false
					}
				],
				city_list:[],
				appStatus: [{
						name: '已获取接入批复',
						value: '1',
						disabled: false
					}, {
						name: '未获取批复',
						value: '2',
						disabled: false
					}
				],
				radiovalue2: '是',
				radiolist2: [{
						name: '是',
						value: 1,
						disabled: false
					},
					{
						name: '否',
						value: 0,
						disabled: false
					}
				],
				radiovalue1: '优先推进',
				rules: {
					'subject_name': {
						type: 'string',
						required: true,
						message: '请选择主体',
						trigger: ['blur', 'change']
					},
					'type_name': {
						type: 'string',
						required: true,
						message: '请选择项目类型',
						trigger: ['blur', 'change']
					},
					'pay_name': {
						type: 'string',
						required: true,
						message: '请选择付款状态',
						trigger: ['blur', 'change']
					},
					'project_no': {
						type: 'string',
						required: true,
						message: '请填写项目编号',
						trigger: ['blur', 'change']
					},
					intro: {
						type: 'string',
						min: 3,
						required: true,
						message: '不低于3个字',
						trigger: ['change']
					},
					'project_name': {
						type: 'string',
						required: true,
						message: '请填写项目名称',
						trigger: ['blur', 'change']
					},
					'project_leader': {
						type: 'string',
						required: true,
						message: '请填写项目负责人',
						trigger: ['blur', 'change']
					},
					'pocket_unit': {
						type: 'string',
						required: true,
						message: '请填写兜底单位',
						trigger: ['blur', 'change']
					},
					'project_content': {
						type: 'string',
						required: true,
						message: '请填写内容',
						trigger: ['blur', 'change']
					},
					'status': {
						type: 'string',
						required: true,
						message: '请选择项目完成状态',
						trigger: ['blur', 'change']
					},
					'pay_status': {
						type: 'string',
						required: true,
						message: '请选择付款状态',
						trigger: ['blur', 'change']
					},
					'pay_money': {
						type: 'string',
						required: true,
						message: '请正确输入付款金额',
						trigger: ['blur', 'change'],
						pattern: /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/,
					},
					'zj_num': {
						type: 'string',
						required: true,
						message: '请正确输入兆瓦量',
						trigger: ['blur', 'change'],
						pattern: /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/,
					},
					'zj_num_mwh': {
						type: 'string',
						required: true,
						message: '请正确输入兆瓦时',
						trigger: ['blur', 'change'],
						pattern: /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/,
					},
					'filings_status': {
						type: 'string',
						required: true,
						message: '请选择备案状态',
						trigger: ['blur', 'change']
					},
					'approval_status': {
						type: 'string',
						required: true,
						message: '请选择批复状态',
						trigger: ['blur', 'change']
					},
					'area_id': {
						type: 'string',
						required: true,
						message: '请选择区域',
						trigger: ['blur', 'change']
					},
					
				},
				userInfo: {},
				cityList: [],
				popupShow: false,
			}
		},
		created() {
			this.typeList()
			this.userInfo = uni.getStorageSync('userInfo');
			this.areaList()
			console.log(this.formData,'d');
		
		},
		watch: {
			detailsData(n, o) {
				if (n.length != 0) {
					let list = this.typeList()
					this.imgArr = []
					Promise.all([list]).then((result) => {
						// console.log(this.type_list)
						//  this.formData.type_id= ''//项目类型id
						//  this.formData.subject_id='' //主体id
						//  console.log(this.type_list)
						//  this.type_list = result[0].type
						//  this.subject_list = result[0].subject
						//  this.formData = this.detailsData
						//  this.$forceUpdate()
					}).catch((error) => {
						console.log(error)
					})
					// console.log(this.subject_list)
					this.formData = this.detailsData
					// this.formData.area_id = 1
					this.areaList()
					
					let searchList = uni.getStorageSync('searchList')
					this.formData.type_name = this.formData.type_name ? this.formData.type_name : searchList.type_list[this.formData.type_id] //类型名称
					// console.log(this.formData.type_name,'this.formData.type_name')
					this.formData.subject_name = searchList.subject_list[this.formData.subject_id] //主体名称
					
					if (this.formData.project_pics) {
						let project_pics = this.formData.project_pics.split(',')
						// console.log(project_pics)
						project_pics.map(item => {
							this.imgArr.push({
								url: `${this.userInfo.url}${item}`
							})
						})
					}
					this.radiovalue1 = this.formData.project_priority == 1 ? '正常推进' : '优先推进'
					this.radiovalue3 = this.formData.status == 1 ? '开发中' : this.formData.status == 2 ? '建设中' : '已暂停'
					this.radiovalue2 = this.formData.is_lx == 1 ? '是' : '否'
					this.formData.project_id = this.detailsId
					// this.logImgArr.push({
					// 	url: `${this.userInfo.url}${this.formData.project_logo}`
					// })
					this.logImgArr = [{
						url: `${this.userInfo.url}${this.formData.project_logo}`
					}]
			
				}
			},
			detailsId(n, o) {
				if (n.length != 0) {
					// console.log(this.detailsId, 222)
				}
			},
			detailComment(n, o) {
				if (n.length != 0) {
					// console.log(this.detailComment, 333)
				}
			},

		},
		onLoad(e) {
			console.log(e,'ediy')

		},
		onShow() {

		},
		methods: {
			...mapActions(['getSearchList']),
			...mapMutations(['searchList']),
			getMessage(){
				this.$emit('getMessage')
			},
			radioChange1(index) {
				if (this.active == index) { // 如果已经选中，则取消选中
					this.active = null;
				} else { // 否则进行选中赋值
					this.active = index;
				}
			},
			async areaList(){
				let res = await areaList()
				this.cityList = res.data
				if(this.formData.area_id && this.cityList.length > 0) this.formData.area_name = this.cityList.filter(item => item.id == this.formData.area_id)[0]?.name
			},
			goPro() {
				uni.navigateTo({
					url: `/pages/index/noticeList/details?type=pro`
				})
			},
			setData() {
				this.formData = this.detailsData
				let searchList = uni.getStorageSync('searchList')
				this.formData.type_name = searchList.type_list[this.formData.type_id] //类型名称
				this.formData.subject_name = searchList.subject_list[this.formData.subject_id] //主体名称
				this.formData.area_name = this.cityList.filter(item => item.id == this.formData.area_id)[0].name
				let project_pics = this.formData.project_pics.split(',')
				// console.log(project_pics)
				project_pics.map(item => {
					this.imgArr.push({
						url: `${this.userInfo.url}${item}`
					})
				})
				this.radiovalue1 = this.formData.project_priority == 1 ? '正常推进' : '优先推进'
				this.radiovalue3 = this.formData.status == 1 ? '开发中' : this.formData.status == 2 ? '建设中' : '已暂停'
				this.radiovalue2 = this.formData.is_lx == 1 ? '是' : '否'
				this.formData.project_id = this.detailsId
				this.logImgArr.push({
					url: `${this.userInfo.url}${this.formData.project_logo}`
				})
			},
			onPullDownRefresh() {
				this.empt()
				setTimeout(function() {
					uni.stopPullDownRefresh();
				}, 1000);
			},
			refuse() {
				this.showCenter = false
			},
			async subTel() {
				// console.log(this.tip)
				if (this.tip == '你确定修改这个项目吗？') {
					let res = await projectUpd(this.formData)
					uni.$u.toast('修改成功')
				} else { //删除
					let res = await projectdel({
						project_id: this.formData.project_id
					})
					uni.$u.toast('删除成功')
					uni.navigateBack()
				}
				this.showCenter = false
			},
			cancel() {
				// console.log(1)
				this.tip = '你确定删除这个项目吗？'
				this.$emit('alter', 1)
				// this.$emit('subTel1',this.tip)
				// this.showCenter = true
			},
			alter() {
				this.tip = '你确定修改这个项目吗？'
				// this.$emit('subTel1',this.tip)
				this.$emit('alter', (this.formData))
				// this.showCenter = true
			},
			priorityChange(item) {
				// console.log(item)
				this.formData.project_priority = item
			},
			lxChange(item) {
				// console.log(item)
				this.formData.is_lx = item
			},
			statusChange(item) {
				// console.log(item)
				// console.log(item)
				this.formData.status = item
			},
			typeChange(e,name){
				this.formData.type_id = e
				this.formData.type_name = name
				this.$refs.form1.validateField('type_name')
			},
			payChange(e) {
				this.formData.pay_status = e
				console.log(this.formData.pay_status)
				this.$refs.form1.validateField('pay_status')
			},
			finishChange(e) {
				this.formData.status = e
				this.$refs.form1.validateField('status')
			},
			preChange(e) {
				this.formData.filings_status = e
				this.$refs.form1.validateField('filings_status')
				console.log(this.formData.filings_status)
			},
			appChange(e){
				this.formData.approval_status = e
				console.log(this.formData.approval_status)
				this.$refs.form1.validateField('approval_status')
			},
			
			pickerChange(e, name) {
				// console.log(e,name)
				this.formData.type_id = e
				this.$refs.form1.validateField('type_name')
			},
			pickerCity(e, name){
				console.log(e,name,'area_id')
				this.formData.area_id = e.toString()
				this.$refs.form1.validateField('area_id')
			},
			pickerChange2(e, name) {
				this.formData.subject_name = name
				this.formData.subject_id = e
				this.$refs.form1.validateField('subject_name')
			},
			async typeList() {
				let res = await this.getSearchList()
				let searchList = this.$store.state.searchList
				let arr1 = []
				let arr2 = []
				let arr3 = []
				for (let k in searchList.type_list) {
					arr1.push({
						name: searchList.type_list[k],
						type_id: k
					})
				}
				for (let k in searchList.subject_list) {
					arr2.push({
						name: searchList.subject_list[k],
						subject_id: k
					})
				}
				for (let k in searchList.is_lx) {
					arr3.push({
						name: searchList.is_lx[k],
						is_lx: k
					})
				}
				this.type_list = arr1
				this.subject_list = arr2
				this.is_lx = arr3
				let listObj = {
					type: this.type_list,
					subject: this.subject_list,
				}
				return new Promise((resolve, reject) => {
					resolve(listObj)
				})
			},
			previewImageFn(i) {
				uni.previewImage({
					urls: this.imgs,
					current: i
				})
			},
			subjectSelect(e) {
				this.formData.subject_name = e.name
				this.formData.subject_id = e.subject_id
				this.$refs.form1.validateField('subject_name')
			},
			hideKeyboard() {
				uni.hideKeyboard()
			},
			typeSelect(e) {
				// console.log(e)
				this.formData.type_id = e.type_id
				this.formData.type_name = e.name
				this.$refs.form1.validateField('type_name')
			},
			upImgs(e) {
				let arr = e.images
				this.formData.project_logo = arr.join(',') //门头照
				console.log(e, this.formData.project_logo,'logo');
			},
			upImgs1(e) {
				let arr = e.images
				let newArr = []
				arr.map(item => {
					if (item.includes(this.userInfo.url)) {
						newArr.push(item.substring(this.userInfo.url.length, item.length))
					} else {
						newArr.push(item)
					}
				})
				// console.log(arr)
				this.formData.project_pics = newArr.join(',') //门头照
				// console.log(this.formData.project_pics)
			},
			radioChange(n) {
				// console.log('radioChange', n);
			},
			empt() {
				this.$refs.imgUpload.empt()
				this.$refs.imgUpload1.empt()
				for (let k in this.formData) {
					this.formData[k] = ''
				}
				this.formData.status = ''
				this.formData.project_priority = 2
				this.formData.is_lx = 1
				this.radiovalue1 = '优先推荐'
				this.radiovalue2 = '是'
				this.radiovalue3 = ''
			},
			goAuth() {
				console.log(this.formData,'表单内容')
				// if (this.active == null) {
				// 	// this.$refs.uToast.show({
				// 	// 	type: 'error',
				// 	// 	title: '同意《项目隐私协议》',
				// 	// 	message: "请同意《项目隐私协议》",
				// 	// })
				// 	uni.$u.toast('请同意《项目隐私协议》')
				// 	return false
				// }
				this.$refs.form1.validate().then(res => {
					projectCreate(this.formData).then(res => {
						if (res.code == 1) {
							uni.navigateTo({
								url: '/my_pages/components/success?title=已提交成功'
							})
							this.$refs.imgUpload.empt()
							this.$refs.imgUpload1.empt()
							for (let k in this.formData) {
								this.formData[k] = ''
							}
							this.formData.status = 1
							this.formData.project_priority = 2
							this.formData.is_lx = 1
							this.radiovalue1 = '优先推进'
							this.radiovalue2 = '是'
							this.radiovalue3 = ''
							
							this.$refs.vvSelect1.emptCheckLabels()
							this.$refs.vvSelect2.emptCheckLabels()
						}
					})
				}).catch(errors => {
					uni.$u.toast('请正确填写信息')
				})
			}
		},
		onReady() {
			//如果需要兼容微信小程序，并且校验规则中含有方法等，只能通过setRules方法设置规则。
			this.$nextTick(() => {
				// 在此处执行你要执行的函数
				// console.log(this.$refs.form1,'this.$refs.form1')
				setTimeout(() => {
					this.$refs.form1.setRules(this.rules)
				}, 100);
			});
		},
	}
</script>
<style>
	.flex-right{
		display: flex;
		justify-content: flex-end;
		text-align: right;	
		
	}
	.upload{
		background: #f8f8fa;
	}
	.upload .u-form-item__body__right,.upload input{
		text-align: right !important;
	}
	.upload .txt-left .u-textarea{
		background-color: #F5F5F5 !important;
	}
	.txt-left textarea{
		text-align: left !important;
	}
	.u-form-item__body__right__message{
		text-align: right;
	}
		
	/deep/ .u-upload__wrap__preview__image,.u-upload__button{
		width: 140rpx !important;
		height: 140rpx !important;
	}
	page {}
	
	/* .radio {
	  display: block;
	  border: 1px solid linear-gradient(##6CBBF5,##157DFA);
	  padding: 6rpx;
	}
	 
	radio .wx-radio-input {
	  border-radius: 50%;
	  width: 28rpx;
	  height: 28rpx;
	}
	 
	 
	radio .wx-radio-input.wx-radio-input-checked {
	  border: 1px solid ##157DFA !important;
	  background: white;
	}
	 
	 
	radio .wx-radio-input.wx-radio-input-checked::before {
	  border-radius: 50%;
	  width: 24rpx;
	  height: 24rpx;
	  line-height: 24rpx;
	  text-align: center;
	  font-size: 0;
	  background: linear-gradient(#6CBBF5,#157DFA);
	  transform: translate(-50%, -50%) scale(1);
	  -webkit-transform: translate(-50%, -50%) scale(1);
	} */
	radio-group text {
		font-size: 26rpx;
		// color: #666666;
	}

	radio .wx-radio-input {
		border-radius: 50%;
		/* 圆角 */
		width: 34rpx;
		border: 1rpx solid #f2f2f2;
		height: 34rpx;
	}

	radio .wx-radio-input.wx-radio-input-checked {
		border: none;
		background: #157DFA;
	}

	radio .wx-radio-input.wx-radio-input-checked::before {
		border-radius: 50%;
		/* 圆角 */
		width: 34rpx;
		/* 选中后对勾大小，不要超过背景的尺寸 */
		height: 34rpx;
		/* 选中后对勾大小，不要超过背景的尺寸 */
		line-height: 30rpx;
		text-align: center;
		font-size: 26rpx;
		/* 对勾大小 30rpx */
		color: #fff;
		/* 对勾颜色 白色 */
		background: #157DFA;
		transform: translate(-50%, -50%) scale(1);
	}
</style>
<style lang="scss" scoped>
	.goNews{
		margin-top: 40rpx;
	}
	.radio-group {
		background: #fff;
	}

	.formItem {
		border-radius: 20rpx;
		padding: 40rpx;
		box-shadow: 0px 0px 1px #8e8787fc;
		border-radius: 20rpx;
		padding: 40rpx;
		margin-top: 30rpx;
		background: #fff;
	}

	.radio {
		display: block;
		border-top: 1px solid #ddd;
		padding: 10rpx;

	}

	.radio:first-child {
		border: none;
	}

	.section_gap {
		line-height: 80rpx;
	}


	::v-deep .u-radio {
		margin-right: 13rpx;
	}

	::v-deep .u-form-item__body__right__content__slot {
		z-index: 100 !important;
	}

	::v-deep .u-textarea__count {
		background-color: transparent !important;
		
	}
	::v-deep .u-textarea{
		background: #F5F5F5;
		color: #979797;
	}

	::v-deep .u-textarea {
		background-color: transparent !important;
		color: #505050;
	}

	::v-deep .vv-input__control {
		color: #505050;
		font-size: 30rpx !important;
	}

	.popupShow {
		overflow: hidden;
		position: fixed;
		z-index: 999999999999;
	}

	::v-deep .u-transition {
		overflow: scroll;
		max-height: 70vh;
	}

	::v-deep .u-radio__text {
		font-size: 30rpx !important;
		color: #505050;
	}

	::v-deep .u-radio-group--row {
		z-index: 10;
		color: #505050;
		justify-content: flex-end;
	}

	::v-deep .u-input {
		background-color: transparent !important;
	}

	::v-deep .u-form-item__body__left__content__label {
		font-size: 28rpx !important;
		font-family: 'PingFang SC';
		font-style: normal;
		color: #081738 !important;
		// margin-bottom: 20rpx;
	}
	// ::v-deep .u-form-item__body__right {
	// 	background: #F5F5F5;
	// 	color:#979797;
	// }
	::v-deep .u-input__content__field-wrapper__field {
		font-size: 28rpx !important;
		color: #505050;
	}

	::v-deep .u-textarea__field {
		font-size: 30rpx !important;
		color: #505050;
	}

	// ::v-deep .u-upload__wrap {
	// 	justify-content: space-between !important;
	// }
	.other-list {
		display: flex;
		align-items: center;
		// border-top: 1px solid #E2E2E2;
		padding: 20rpx 0;
		color: #505050;

		.left {}

		.right {
			display: flex;
			align-items: center;
			width: 80%;

			.myAddress {
				display: flex;
				flex-direction: column;
				width: 100%;

				.cityAddres {
					display: flex;

					.top {
						flex: 1;
					}

					.city {
						width: 48px;
						display: flex;
					}
				}

				.address {}
			}
		}
	}

	.upload {
		padding: 0 20rpx;
		font-size: 28rpx;
		margin-bottom: 100rpx;
	}

	.evalute {
		color: #979797;
		margin-top: 20rpx;
	}

	.alterPro {
		position: fixed;
		width: 100%;
		bottom: 0px;
		z-index: 9999999999991;
		left: 0;
		background: #fff;
		justify-content: center;
		align-items: center;
		height: 60px;
		// background: rebeccapurple;
		border-top-left-radius: 20px;
		border-top-right-radius: 20px;
		display: flex;
	}

	.checked {
		// color: green;
		// background-color: #ddd;
	}

	.custom_style {
		color: #fff;
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		font-size: 24rpx;

		&_icon {
			// background-color: #15357A;
			background-image: url(../../static/Ellipse.png);
			font-size: 80rpx;
			width: 120rpx;
			height: 120rpx;
			border-radius: 100%;
			display: flex;
			background-repeat: no-repeat;
			background-size: 100%;
			justify-content: center;
			align-items: center;
			margin-top: -50rpx;
		}
	}
</style>